#ifndef _CONFIG_H
#define _CONFIG_H

#include <string>
#include <memory>
#include <mutex>
#include <QString>
class QJsonObject;

struct DataBase {
    QString username;
    QString password;
    QString hostDB;
    QString dbname;
    QString patroltal;
    QString postionbl;
    QString dbpath;
};

struct Config {
    QString Dir;
    QString FtpConf;
    QString ExpireDate;
    double UsageThreshold;
    QString hostAddress;
    DataBase DataBase;
};
class configmanager
{
private:
    /* data */
public:
    ~configmanager();
    configmanager(const configmanager &) = delete;
    configmanager& operator=(const configmanager&) = delete;
    static  configmanager& GetInstance();
    //CRC校验
   // 声明 readAndParseJson 函数
Config readAndParseJson(const QString &filePath);
private:
    configmanager();

    static std::unique_ptr<configmanager> m_InStance;
    static std::once_flag m_Flag;

    QString m_Crc; //crc返回值
};


#endif // _CONFIG_H
